///////////////////////////////////////////////////////////////////////////////
//
// Licensed under the MIT License
//
// Copyright (c) 2010 Chris Colinsky
// All Rights Reserved
//
// version	0.5
// http://code.google.com/p/sugarcookie/
// http://code.google.com/p/sugarcookie/wiki/License
//
////////////////////////////////////////////////////////////////////////////////

package sugarcookie.utils {
	public class HexadecimalUtil {
		public static function NumberToHex(number:uint):String {
			return number.toString(16);
		}
		
		public static function HexToNumber(hex:Object):uint {
			var val:uint;
			
			if (typeof hex=="string") {
				hex = hex.indexOf("0x")==0?hex:"0x"+hex;
				val = uint(parseInt(String(hex)));
			} else if (typeof hex=="number") {
				if (String(hex).indexOf("0x")==0) val = uint(parseInt(String(hex)));
				else val = uint(hex);
			}
			
			return val;
		}
	}
}